package com.xyhy.core.jackson.type;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.core.type.TypeReference;
import com.xyhy.core.jackson.JacksonMapper;

public class ListTypeReference<T> extends TypeReference<List<T>> {
  protected final Type type;

  public ListTypeReference(Class<T> clazz) {
    type = JacksonMapper.instance.objectMapper.getTypeFactory().constructParametricType(ArrayList.class, clazz);
//    Type superClass = getClass().getGenericSuperclass();
//    this.type =  ((ParameterizedType) superClass).getActualTypeArguments()[0];
  }

  @Override
  public Type getType() {
    return type;
  }

}
